layui.use(['jquery','layer','upload', 'backend'], function () {
    var $ = layui.jquery;
    var upload = layui.upload;
    var backend = layui.backend;

    //选完文件后不自动上传
    var uploadInst = upload.render({
        elem: '#logo-img'
        ,url: '/admin/attachment/upload'
        ,auto: false
        ,exts: 'jpg|png|gif|bmp|jpeg'
        ,size: 1000
        ,bindAction: '#logo-upload-button'
        ,done: function(res){
            if(res.code == 1){
                layer.msg(res.msg,{icon:1,time:500},function(){
                    backend.api.close();
                });
            } else {
                layer.confirm(res.msg, {icon: 3, title:'警告'}, function(index){
                    layer.close(index);
                });
            }
        }
    });
});
